<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCartsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('carts', function (Blueprint $table) {
            $table->id();
            $table->integer('member_id')->default(0)->comment('会员ID');
            $table->integer('goods_id')->default(0)->comment('商品ID');
            $table->integer('sku_id')->default(0)->comment('属性ID');
            $table->integer('num')->default(1)->comment('数量');
            $table->float('price', 8, 2)->default('0.00')->comment('商品单价');
            $table->float('discount_amount', 8, 2)->default('0.00')->comment('优惠金额');
            $table->float('total_amount', 8, 2)->default('0.00')->comment('商品总价');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('carts');
    }
}
